Back to course home
0% completed
Vote For New Content
Oracle Hard
Integer to English Words (hard)
Solution: Integer to English Words
Trapping Rain Water (hard)
Solution: Trapping Rain Water
First Missing Positive (hard)
Solution: First Missing Positive
Merge K Sorted Lists (hard)
Solution: Merge K Sorted Lists
Max Points on a Line (hard)
Solution: Max Points on a Line
Sudoku Solver (hard)
Solution: Sudoku Solver
Longest Valid Parentheses (hard)
Solution: Longest Valid Parentheses
Remove Nth Node From End of List (Medium)
Solution: Remove Nth Node From End of List
Median of Two Sorted Arrays (hard)
Solution: Median of Two Sorted Arrays
Constrained Subsequence Sum (hard)
Solution: Constrained Subsequence Sum
Longest Common Subsequence (medium)
Problem Statement
Given two strings 's1' and 's2', find the length of the longest subsequence which is common in both the strings.
A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.
Example 1:
Input: s1 = "abdca"
s2 = "cbda"
Output: 3
Explanation: The longest common subsequence is "bda".
Example 2:
Input: s1 = "passport"
s2 = "ppsspt"
Output: 5
Explanation: The longest common subsequence is "psspt".
Constraints:
- 1 <= s1.length, s2.length <= 1000`
s1ands2consist of only lowercase English characters.
Try it yourself
Try solving this question here:
Java
. . . .
Solution: Binary Tree Zigzag Level Order Traversal
Solution: Longest Common Subsequence
Mark as Completed
On this page
Problem Statement
Try it yourself